package com.flea.model;

/**
 * 封装json返回的对象
 */
public class Result<T> {
    private T data;
    private boolean success;
    private String message;

    public Result() {
    }

    public T getData(){
        return data;
    }

    public boolean getSuccess() {
        return success;
    }

    public String getMessage() {
        return message;
    }





    public static Result fail(String message) {
        Result result = new Result();
        result.success=false;
        result.message=message;

        return result;
    }

    public static Result success() {
        Result result = new Result();
        result.success=true;

        return result;
    }

    public static <T> Result<T> success(T data) {
        Result result = new Result();
        result.success=true;
        result.data=data;

        return result;
    }
}
